<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            border: 3px dashed #ccc;
            padding: 20px;
        }
    </style>
    <script src="../assets/js/vue.js"></script>
</head>

<body>
    <div id="app" class="box">
        <p>CompA</p>
        <br>
        <comp-b></comp-b>
        <br>
        <comp-c></comp-c>
    </div>

    <script>
        new Vue({
            el: "#app",
            components: {
                CompB: {
                    template: `
                        <div class="box">
                            <p>CompB</p>
                            <comp-d></comp-d>
                            <br>
                            <comp-e></comp-e>
                        </div>
                    `,
                    components: {
                        CompD: {
                            template: `
                                <div class="box">
                                    <p>CompD</p>
                                </div>
                            `,
                            beforeMount() {
                                console.log("======>CompD-beforeMount")
                            },
                            mounted() {
                                console.log("======>CompD-mounted")
                            },
                        },
                        CompE: {
                            template: `
                                <div class="box">
                                    <p>CompE</p>
                                </div>
                            `,
                            beforeMount() {
                                console.log("======>CompE-beforeMount")
                            },
                            mounted() {
                                console.log("======>CompE-mounted")
                            },
                        }
                    },
                    beforeMount() {
                        console.log("====>CompB-beforeMount")
                    },
                    mounted() {
                        console.log("====>CompB-mounted")
                    },
                },
                CompC: {
                    template: `
                        <div class="box">
                            <p>CompC</p>
                        </div>
                    `,
                    beforeMount() {
                        console.log("====>CompC-beforeMount")
                    },
                    mounted() {
                        console.log("====>CompC-mounted")
                    },
                },
            },
            beforeMount() {
                console.log("==>CompA-beforeMount")
            },
            mounted() {
                console.log("==>CompA-mounted")
            },
        })
    </script>
</body>

</html>